package org.btik.p2p.ipv4;

/**
 * P2p通道
 *
 * @author lustre
 * @since 2022/9/8 23:18
 */
public class P2pChannel {

    private String channelId;

    private byte[] sender;

    private int senderPort;

    private byte[] receiver;

    private int receiverPort;

    private long lastActiveTime;

    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    public byte[] getSender() {
        return sender;
    }

    public void setSender(byte[] sender) {
        this.sender = sender;
    }

    public byte[] getReceiver() {
        return receiver;
    }

    public void setReceiver(byte[] receiver) {
        this.receiver = receiver;
    }

    public int getSenderPort() {
        return senderPort;
    }

    public void setSenderPort(int senderPort) {
        this.senderPort = senderPort;
    }

    public int getReceiverPort() {
        return receiverPort;
    }

    public void setReceiverPort(int receiverPort) {
        this.receiverPort = receiverPort;
    }

    public P2pChannel(String channelId) {
        this.channelId = channelId;
        this.lastActiveTime = System.currentTimeMillis();
    }

    public long getLastActiveTime() {
        return lastActiveTime;
    }

    public void setLastActiveTime(long lastActiveTime) {
        this.lastActiveTime = lastActiveTime;
    }

    public void reset() {
        this.receiver = null;
        this.receiverPort = 0;
        this.sender = null;
        this.senderPort = 0;
    }
}
